forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 151
bugfix(ui): Fix window animations to scale with display resolution #2210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tophroxx
wants to merge
8
commits into
TheSuperHackers:main
Choose a base branch
from
tophroxx:use-scaled-pixel-constants-in-window-animations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
bugfix(ui): Fix window animations to scale with display resolution #2210
tophroxx
wants to merge
8
commits into
TheSuperHackers:main
from
tophroxx:use-scaled-pixel-constants-in-window-animations
+94
−36
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Greptile Overview
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp | Added resolution scaling to window animation velocities and thresholds |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp | Added resolution scaling to window animation velocities and thresholds (identical to Generals) |
Sequence Diagram
sequenceDiagram
participant Constructor
participant initAnimateWindow
participant Helper as getDisplayWidthScaler()<br/>getDisplayHeightScaler()
participant Display as TheDisplay
participant updateAnimateWindow
Note over Constructor: Constructor called
Constructor->>Constructor: Set m_maxVel = 0.0f
Constructor->>Constructor: Set m_slowDownThreshold = 0
Note over initAnimateWindow: Animation initialized
initAnimateWindow->>Helper: Call scaler function
Helper->>Display: getWidth()/getHeight()
Display-->>Helper: Current resolution
Helper-->>initAnimateWindow: resolution / DEFAULT_DISPLAY (800x600)
initAnimateWindow->>initAnimateWindow: m_maxVel *= scaler
initAnimateWindow->>initAnimateWindow: m_slowDownThreshold *= scaler
Note over updateAnimateWindow: Animation updates each frame
updateAnimateWindow->>updateAnimateWindow: Use scaled m_maxVel
updateAnimateWindow->>updateAnimateWindow: Compare against scaled threshold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 2 comments
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
xezon
reviewed
Jan 29, 2026
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
xezon
reviewed
Jan 29, 2026
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
…comments for current date
Author
|
Done all requested changes and replicated the fix for vanilla Generals. Works there as well. |
xezon
reviewed
Jan 30, 2026
Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes window animation speeds and smoothing on different display resolutions. Closes #2130
I've made a quick video showcasing new behavior and retail behavior side-by-side. Unfortunately it was too big for GitHub, so i uploaded it to YouTube.
https://youtu.be/wDQdis7Z1L4
Pay attention to how fast the control bar slides from the bottom when i'm loading into a match, and also how fast the diplomacy screen slides from the top.
This PR adds 2 new
methods to the Display classlocal helper functions and changes 4 children of theProcessAnimateWindowclass -SlideFromLeft,SlideFromRight,SlideFromTopandSlideFromBottom, making them benefit from these new methods.It also moves velocity and slowdown threshold initialization from the constructor into
initAnimateWindow, which means that these values will scale properly even if user changes their resolution in runtime.I've made little changes to minimize the possibility of new issues appearing while still fixing the issue.